<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h5 class="modal-title">输入量</h5>
</div>

<div class="main-body" >

    <div >
        <div >
            <div >
                <label>参数测点</label>
                <table id="dataTable_parameterIn" data-url="/project/accountManage/inParameter_data" data-page-list=[]
                       data-striped="true" data-pagination="true" data-page-size="15" data-cache="false">

                </table>
            </div>
        </div>
    </div>

</div>
<div class="modal-footer" style="text-align:center">

    <button type="button" class="btn btn-primary" onclick="chooseInParameter()">确定</button>
</div>


<script>

    //table字段
    var dataFormat = [{
        checkbox: true
    },{
        field: 'code',
        title: '编号',
        align: 'center'
    },{
        field: 'name',
        title: '名称',
        align: 'center'
    },{
        field: 'objName',
        title: '对象',
        align: 'center'
    }];

    getTableConditon(dataFormat, "dataTable_parameterIn");

    function getTableConditon (dataFormat,id) {
        $("#"+id).bootstrapTable({
            method:"get",
            sidePagination:"server",
            dataType: "json",
            queryParams: function queryParams(params) {   //设置查询参数
                var param = {
                    pageNum: params.offset/params.limit
                };
                $(".search-data").each(function () {
                    var key = $(this).attr("name");
                    var val = $(this).val();
                    if (val){
                        param[key] = val;
                    }
                });
                console.log(param);
                return param;
            },
            columns:dataFormat
        });
    }

   function chooseInParameter() {

       var getSelectRows = $("#dataTable_parameterIn").bootstrapTable('getSelections', function (row) {
           return row;
       });

       if(getSelectRows){
           $("#input").text("");

       for(i=0;i<getSelectRows.length;i++){
           var value;
           if(getSelectRows[i].objType==1031){
               value='电压';
           }
           if(getSelectRows[i].objType==1032){
               value='SOC';
           }
           if(getSelectRows[i].objType==1033){
               value='温度';
           }
           if(getSelectRows[i].objType==1034){
               value='其他';
           }
           $("#input").append(getSelectRows[i].name+"("+value+")"+"\n");
           }
       }

        $("#modal_parameter").modal('hide');  //手动关闭
    }
</script>